package com.yy.tools.data
{
	public class DT
	{
		/**
		 *数据处理类 
		 * 
		 */
		public function DT()
		{
		}
		/**
		 * @param coypSource
		 * @param toSource
		 * 
		 */		
		public static function coypObjectData(coypSource:Object,toSource:Object):void
		{
			if(coypSource is XML)
			{
				xmlObjectData(coypSource as XML,toSource);
			}else
			{
				objObjectData(coypSource,toSource);
			}
		}
		private static function objObjectData(coypSource:Object,toSource:Object):void
		{
			for(var str:String in coypSource)
			{
				if(toSource.hasOwnProperty(str))
				{
					toSource[str] = coypSource[str];
				}
			}
		}
		//把中文字转换成16进制的Unicode编码
		public static function toUnicode(str:String, separateStr:String="-"):String {
			var temp:String = "";
			for(var i:int=0; i<str.length; i++) {
				if(temp.length > 1) {
					temp += separateStr + str.charCodeAt(i).toString(16);
				}else {
					temp = String(str.charCodeAt(i).toString(16));
				}
			}
			return temp;
		}
	}
}